package org.mch.func.file.filedelete;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.mch.biz.ui.FuncEvent;
import org.mch.biz.ui.FuncPanel;
import org.mch.swingm.ext.METextChooser;
import org.mch.swingm.obj.MItem;

public class ClientPanel extends FuncPanel {
	private static final long serialVersionUID = 1L;
	private JPanel panel;
	private JButton btn_execute;
	private METextChooser text_rootpath;
	private JScrollPane scrollPane;
	private RSyntaxTextArea text_filename;

	public ClientPanel() {
		initComponents();
	}

	private void initComponents() {
		setLayout(new BorderLayout(0, 0));
		add(getPanel());
	}

	public JPanel getPanel() {
		if (this.panel == null) {
			this.panel = new JPanel();
			panel.setPreferredSize(new Dimension(200, 10));
			panel.setBorder(new LineBorder(Color.LIGHT_GRAY));
			this.panel.setLayout(null);
			panel.add(getText_rootpath());
			panel.add(getBtn_execute());
			panel.add(getScrollPane_1());
		}
		return this.panel;
	}

	protected FuncEvent createEvent() {
		return new ClientEvent(this);
	}

	public JButton getBtn_execute() {
		if (btn_execute == null) {
			btn_execute = new JButton("\u6267\u884C");
			btn_execute.setFont(new Font("宋体", Font.PLAIN, 16));
			btn_execute.setMargin(new Insets(2, 2, 2, 2));
			btn_execute.setBounds(763, 12, 72, 33);
			btn_execute.addActionListener(getEvent());
		}
		return btn_execute;
	}

	public METextChooser getText_rootpath() {
		if (text_rootpath == null) {
			text_rootpath = new METextChooser(new MItem("复制文件目标目录："), METextChooser.SELECT_FOLDER);
			text_rootpath.getLabel().setToolTipText("将当前目录下所有列表文件进行删除。");
			text_rootpath.getLabel().setText("执行删除文件根目录：");
			text_rootpath.setBounds(10, 12, 741, 33);
		}
		return text_rootpath;
	}

	public JScrollPane getScrollPane_1() {
		if (scrollPane == null) {
			scrollPane = new JScrollPane();
			scrollPane.setBorder(new TitledBorder(new LineBorder(new Color(184, 207, 229)), "\u5220\u9664\u6587\u4EF6\u5217\u8868",
					TitledBorder.LEADING, TitledBorder.TOP, null, new Color(51, 51, 51)));
			scrollPane.setBounds(10, 57, 825, 428);
			scrollPane.setViewportView(getText_filename());
		}
		return scrollPane;
	}

	public RSyntaxTextArea getText_filename() {
		if (text_filename == null) {
			text_filename = new RSyntaxTextArea();
			text_filename.setFont(new Font("宋体", Font.PLAIN, 13));
			text_filename.setBorder(new LineBorder(Color.LIGHT_GRAY, 2));
		}
		return text_filename;
	}
}